package com.cqc.mebaidumapdemo.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.baidu.mapapi.SDKInitializer;
import com.cqc.mebaidumapdemo.utils.LogUtil;
import com.cqc.mebaidumapdemo.utils.ToastUtil;

/**
 * Created by ${cqc} on 2017/7/5.
 */

public class SDKReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
        LogUtil.d(action);
        switch (action) {
            case SDKInitializer.SDK_BROADCAST_ACTION_STRING_NETWORK_ERROR:
                ToastUtil.showShortToast(context, "网络异常，请检查网络");
                break;

            case SDKInitializer.SDK_BROADTCAST_ACTION_STRING_PERMISSION_CHECK_ERROR:
                ToastUtil.showShortToast(context, "请给权限");

                break;

            case SDKInitializer.SDK_BROADTCAST_ACTION_STRING_PERMISSION_CHECK_OK:
                ToastUtil.showShortToast(context, "已给权限");

                break;
            default:
                ToastUtil.showShortToast(context, "action是：" + action);
                break;
        }
    }
}
